<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>   
<% //Grab the username and emp_id from the session
String uname=(String)session.getAttribute("userName");
String emp_id=(String)session.getAttribute("emp_id");
int ei=Integer.parseInt(emp_id);
%>
<h1>Projects Involved</h1>
<ul class="sidemenu">
    <%
    String query="select distinct(project.name) from project, task ,task_division where task_division.emp_id='"+ei+"'"+" and task.task_id=task_division.task_id and task.project_id=project.project_id";
    Connection db_conn = null;
    Statement statement = null;
    PreparedStatement pstmt;
    ResultSet rs;
    try{
    Class.forName("com.mysql.jdbc.Driver");
    String url= "jdbc:mysql://localhost:3306/db";
    db_conn = DriverManager.getConnection( url,"root", "root" );
    statement = db_conn.createStatement();
    rs=statement.executeQuery(query);
    while (rs.next()) { // parse the results
    
    out.print("<li><a href='"+"user.jsp?pageid=project&&projectName="+rs.getString("project.name")+"'"+">"+rs.getString("project.name")+"</a></li>");
    }
    db_conn.close();
    } catch(SQLException e){
    e.printStackTrace();
    out.println("sql not found");
    out.println(e);
    } catch(ClassNotFoundException e){
    e.printStackTrace();
    out.println(e);
    }
    %>
</ul>		
